package com.mjw.zstu.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mjw.zstu.entity.User;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

@Component
public interface UserMapper extends BaseMapper<User> {

    @Select("SELECT\n" +
            "\t*\n" +
            "FROM\n" +
            "\t`user`\n" +
            "\tINNER JOIN\n" +
            "\tshipping_address\n" +
            "\tON \n" +
            "\t\t`user`.user_id = shipping_address.user_id")
    public List<Map> find();
    @Select("SELECT address_name FROM user INNER JOIN shipping_address on user.user_id=shipping_address.user_id WHERE user.user_id=#{id}")
    public List<Map> getUserAddress(Integer id);

}
